//
//  test.cpp
//  9.24_bloom_filter
//
//  Created by Shi HaoRan on 2023/9/24.
//

#include "bit_set.h"
#include "bloom_filter.h"
#include <iostream>

using namespace std;

void test1()
{
    shr::bit_set<100> bs;
    bs.set(0);
    bs.set(39);
    bs.set(78);
    bs.set(99);
    
    cout << bs.test(0) << ' ';
    cout << bs.test(39) << ' ';
    cout << bs.test(78) << ' ';
    cout << bs.test(99) << ' ';
    cout << bs.test(50) << endl;
    
    bs.flip(0);
    bs.flip(39);
    bs.flip(50);
    
    cout << bs.test(0) << ' ';
    cout << bs.test(39) << ' ';
    cout << bs.test(78) << ' ';
    cout << bs.test(99) << ' ';
    cout << bs.test(50) << endl;
}

void test2()
{
  shr::bloom_filter<100> bf;
  
  string str1("My name's shr");
  string str2("Where are you from");
  string str3("hhhhhhhh");
  string str4("www.baidu.com");
  
  bf.set(str1);
  bf.set(str4);
  
  cout << bf.test(str1) << endl;
  cout << bf.test(str2) << endl;
  cout << bf.test(str3) << endl;
  cout << bf.test(str4) << endl;
}

int main()
{
    //test1();
    test2();
    return 0;
}
